{template 'header', $module}
<div class="main-block bd-gray">
	{template 'business_header', $module}
	<!--{if $action=='listPicture'}-->
	<form id="pub-form" name="pub-form" method="post" action="{url('member/business')}">
		<input type="hidden" name="action" value="listPicture"/>
		<input type="hidden" name="submit" value="1"/>
		<table class="data-form" style="width: 100%">
			<tr>
				<td class="tr">
					{*Post::picture(33, 'thumb', 'post[thumb]', '' ,645, 450)*}
					{Post::multiUpload('images',33, $pictureList)}
				</td>
			</tr>
			<tr>
				<td class="sub-info">
					<button type="submit" class="btn">保存</button>
				</td>
			</tr>
		</table>
	</form>
	<!--{/if}-->
	<!--{if $action=='mainStore'}-->
	<div class="licence_status_ctr">
		<span class="licence_status_0 licence_staus" {if $businessAuth[license_status] == 0}style="display:block"{else}style="display:none;"{/if}>
			当前没有上传营业执照, 请 上传.
		</span>
		<span class="licence_status_1 licence_staus" {if $businessAuth[license_status] == 1}style="display:block"{else}style="display:none;"{/if}>
			当前提交的营业执照信息不准确, 请重新 上传.
		</span>
		<span class="licence_status_2 licence_staus" {if $businessAuth[license_status] == 2}style="display:block"{else}style="display:none;"{/if}>
			当前营业执照已经上传, 请等待信息审核.
		</span>
		<span class="licence_status_3 licence_staus" {if $businessAuth[license_status] == 3}style="display:block"{else}style="display:none;"{/if}>
			营业执照审核通过!
		</span>
		<div id="J_upload_license_Ctr" class="licence_upload" {if in_array($businessAuth[license_status], array(2, 3))}style="display: none;"{/if}>
			<form id="J_upload_license" enctype="multipart/form-data" method="POST">
				<input type="file" name="license" id="license"/> <button type="submit">上传</button>
			</form>
			<script>
				seajs.use(['$','easyui'], function($){
					$('#J_upload_license').form({
						url:'business.php?action=ajaxUploadLicense',
						onSubmit: function(){
							if(!$('#license').val()) {
								$.messager.alert('请选择营业执照!');
							}
						},
						success:function(data){
							if (data=='file_ext_unable') {
								$.messager.alert('请上传图片!');return;
							}
							if (data=='file_size_big') {
								$.messager.alert('请上传不大于500K的图片!');return;
							}
							if (data=='file_error') {
								$.messager.alert('上传错误, 请重试!');return;
							}
							if (data=='file_upload_success') { // upload ok
								$('#J_upload_license_Ctr').hide();
								$('.licence_staus').hide();
								$('.licence_status_2').show();
							}
						}
					});
				})
			</script>
		</div>
	</div>
	<form id="pub-form" name="pub-form" method="post" action="{url('member/business')}">
		<input type="hidden" name="action" value="{$action}"/>
		<input type="hidden" name="forward" value="{$forward}"/>
		<table class="data-form">
			{if $item[status] ==2}
			<tr>
				<td colspan="2">
					<span class="info-check info-checking" style="display: block;">当前信息正在审核中 . </span>
				</td>
			</tr>
			{/if}
			{if $item[status] ==1}
			<tr>
				<td colspan="2">
					<span class="info-check info-unchecked" style="display: block;">信息未审核通过, 请编辑后重新提交</span>
				</td>
			</tr>
			{/if}
			<tr>
				<th width="90"><span class="cred">*</span>商家名称</th>
				<td class="tr">
					<input class="easyui-validatebox" data-options="required:true,validType:['length[3,50]']" name="post[shopname]" type="text" size="30" value="{$item[shopname]}"/>
					{if $item} <a href="{url('member/business')}?action=addBranchStore">添加分店</a>{/if}
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>形象图片</th>
				<td class="tr">
					{Post::picture(33, 'thumb', 'post[thumb]', $item[thumb] ,215, 150)}
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>商家分类</th>
				<td class="tr">
					{Post::cateCombo('post[catid]', $item['catid'], 33, '', '')}
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>地址</th>
				<td class="tr">
					{Post::areaCombo('post[areaid]', $item[areaid], '', '', $moduleid )} <br>

				</td>

			</tr>

            <tr>
                <th width="90"><span class="cred">*</span>详细地址</th>
                <td class="tr">

                    <input style="margin-top: 10px;" class="easyui-validatebox" data-options="required:true,validType:['length[3,50]'],missingMessage:'请输入详细地址!'" name="post[address]" type="text" size="30" value="{$item[address]}"/>
                </td>

            </tr>


			<tr>
				<th width="90"><span class="cred">*</span>电话</th>
				<td class="tr">
					<input class="easyui-validatebox" data-options="required:true,missingMessage:'请输入联系电话!'" name="post[tel1]" type="text" size="30" value="{$item[tel1]}"/>
					<input name="post[tel2]" type="text" size="30" value="{$item[tel2]}"/>
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>经营项目</th>
				<td class="tr">
					<textarea name="post[business]" style="width: 400px;height: 50px;">{$item[business]}</textarea>
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>优惠折扣</th>
				<td class="tr">
					<textarea name="post[youhui_zhekou]" style="width: 400px;height: 25px;">{$item[youhui_zhekou]}</textarea>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td style="padding-top: 0;">{template 'business-youhui', 'member'}</td>
			</tr>
			<tr>
				<th width="90">优惠提示</th>
				<td class="tr">
					<textarea name="post[youhui_tishi]" style="width: 400px;height: 25px;">{$item[youhui_tishi]}</textarea>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td style="padding-top: 0;">{template 'business-youhuitishi', 'member'}</td>
			</tr>
			<tr>
				<th width="90">停车场位置</th>
				<td class="tr">
					<textarea name="post[carstop]" style="width: 400px;height: 50px;">{$item[carstop]}</textarea>
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>详细信息</th>
				<td class="tr">
					{Post::kindEditor('post[content]', $moduleid, $item['content'], 'datatype="*5-99999" nullmsg="请填写详细说明" errormsg="详细说明最少5字"','675px')}
				</td>
			</tr>
			<tr>
				<th width="50">我的位置</th>
				<td class="tr">
					<input type="text" readonly="readonly" id="point" name="post[zuobiao]"  size="40" class=" graybd-ipt fn-left mr10" {if $item['langitude'] && $item['latitude']}value="{$item['langitude']},{$item['latitude']}"{/if}/>
					<button id="markLoc" class="btn fn-left" type="button">标注位置</button>
				</td>
			</tr>
			{template 'business-license', 'member'}
			<tr>
				<th>&nbsp;</th>
				<td class="sub-info">
					<button type="submit" class="btn">提 交</button>
					<input type="button" value=" 返 回 " class="btn" onclick="history.back();"/>
				</td>
			</tr>
		</table>
    </form>
	<!--{/if}-->
	<!--{if $action=="addBranchStore" || $action=="editBranchStore"}-->
	<form id="pub-form" name="pub-form" method="post" action="{url('member/business')}">
		<input type="hidden" name="action" value="{$action}"/>
		<input type="hidden" name="itemid" value="{$item[itemid]}"/>
		<input type="hidden" name="forward" value="{$forward}"/>
		<table class="data-form">
			<tr>
				<th width="90"><span class="cred">*</span>分店名称</th>
				<td class="tr">
					<input class="easyui-validatebox" data-options="required:true,validType:['length[3,50]']" name="post[nickname]" type="text" size="30" value="{$item[nickname]}"/>
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>地址</th>
				<td class="tr">
					{Post::areaCombo('post[areaid]', $item[areaid], '', '', $moduleid )} <br>
					<input style="margin-top: 10px;" class="easyui-validatebox" data-options="required:true,validType:['length[3,50]'],missingMessage:'请输入详细地址!'" name="post[address]" type="text" size="30" value="{$item[address]}"/>
				</td>
			</tr>
			<tr>
				<th width="90"><span class="cred">*</span>电话</th>
				<td class="tr">
					<input class="easyui-validatebox" data-options="required:true,missingMessage:'请输入联系电话!'" name="post[tel1]" type="text" size="30" value="{$item[tel1]}"/>
					<input name="post[tel2]" type="text" size="30" value="{$item[tel2]}"/>
				</td>
			</tr>
			<tr>
				<th width="90">停车场位置</th>
				<td class="tr">
					<textarea name="post[carstop]" style="width: 400px;height: 50px;">{$item[carstop]}</textarea>
				</td>
			</tr>
			<tr>
				<th width="50">我的位置</th>
				<td class="tr">
					<input type="text" readonly="readonly" id="point" name="post[zuobiao]" size="40" class=" graybd-ipt fn-left mr10"  {if $item['langitude'] && $item['latitude']}value="{$item['langitude']},{$item['latitude']}"{/if}/>
					<button id="markLoc" class="btn fn-left" type="button">标注位置</button>
				</td>
			</tr>
			{template 'business-license', 'member'}
			<tr>
				<th>&nbsp;</th>
				<td class="sub-info">
					<button type="submit" class="btn">提 交</button>
					<input type="button" value=" 返 回 " class="btn" onclick="history.back();"/>
				</td>
			</tr>
		</table>
	</form>
	<!--{/if}-->
	<!--{if $action=='branchStore'}-->
	<form method="post" action="{url('member/my')}">
		<table class="filter-tb mt10 c000 con">
			<thead>
			<tr class="c666">
				<th width="300">标 题</th>
				<th width="150">分 类</th>
				<th width="120">{if $timetype=='add'}添加{else}更新{/if}时间</th>
				<th width="60">浏览</th>
				<th width="120">管理</th>
			</tr>
			</thead>
			<tbody id="pub-list">
			{loop $branchStores $k $v}
			<tr>
				<td>({$v[nickname]})</td>
				<td>{$v[catname]}</td>
				<td class="c666" title="更新时间">{$v[editdate]}</td>
				<td class="c666">{$v[hits]}</td>
				<td class="pub-oper">
					<a class="edit" href="{url('member/business')}?action=editBranchStore&itemid={$v[itemid]}" title="编辑">编辑</a>
					<a class="del" href="{url('member/business')}?action=deleteBranchStore&itemid={$v[itemid]}" onclick="return confirm('确定要删除吗？此操作将不可撤销');" title="删除">删除</a>
				</td>
			</tr>
			{/loop}
			</tbody>
		</table>
	</form>
	<!--{/if}-->
</div>
<!--map start-->
<div id="mapDlgWrap" style="display:none;">
    <div id="mapDlg" class="easyui-dialog" title="标注位置" style="padding:10px;text-align: center" data-options="closed:'true'">
        <p style="text-align:left;color:red;">温馨提示：您可以在地图中点击右键添加标注。</p>
        {php $currentAreaid = Area::area2id(Area::ip2area($DT_IP))}
        <iframe width="500" height="350" border='0' src="{SITE_URL}api.php?aM=map&aA=member&city={if $item['langitude'] && $item['latitude']}{$item['langitude']},{$item['latitude']}{elseif $currentAreaid}{Area::pos($areaid,'')}{else}{urlencode('中国')}{/if}" frameborder='0' scrolling="no"></iframe>
    </div>
</div>
<!--map end-->
<!--{if $action=="mainStore"}-->
<script>
	seajs.use(['$','easyui', 'easyui-css'], function ($) {
		$("#pub-form").form();
	});
</script>
<!--{/if}-->
<!--{if $action=="addBranchStore" || $action=='editBranchStore'}-->
<script>
	seajs.use(['$','easyui', 'easyui-css'], function ($) {
		$("#pub-form").form();
	});
</script>
<!--{/if}-->
{template 'footer', $module}